import React from 'react';
import Taro from '@tarojs/taro';
import { View, Text, Image } from '@tarojs/components';
import { GStyleSheet } from '@/utils/DarkMode';
import i18n from 'i18n-js';
import searchIcon from '@/assets/images/icon_search.png';
import './SearchingView.less';

const dstyles = GStyleSheet.create({
  scanView: {
    height: Taro.getSystemInfoSync().screenHeight * 0.3,
    width: '90%',
    marginBottom: 10,
    borderRadius: 24,
    backgroundColor: '#F4F4F4',
    paddingTop: 35,
    paddingBottom: 35,
    display: 'flex',
    position: 'relative',
    flexDirection: 'column',
    justifyContent: 'space-between',
    alignItems: 'center',
  },
  scan: {
    width: 105,
    height: 105,
    display: 'flex',
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: 'rgba(46, 155, 255, 0.4)',
    borderRadius: '50%',
    alignSelf: 'center',
    position: 'absolute',
    top: '50%',
    left: '50%',
    transform: 'translate(-50%,-50%)',
    zIndex: 10,
  },
  searchIcon: {
    width: 30,
    height: 30,
  },
});

const SearchingView: React.FC = () => {
  const styles = dstyles.useDynamicStyle();
  return (
    <View style={styles.scanView}>
      <Text style={{ fontSize: 16 }}>{i18n.t('SCANNING_NEARBY_DEVICES')}</Text>
      <View style={styles.scan} className='scan-view'>
        <Image src={searchIcon} style={styles.searchIcon} />
      </View>
      <View className='scan-view-1' />
      <View className='scan-view-2' />
      <Text style={{ fontSize: 12, color: '#999999' }}>
        {i18n.t('KEEP_YOUR_PHONE_AS_CLOSE_AS_POSSIBLE_TO_THE_DEVCIE_YOU_WANT_TO_ADD')}
      </Text>
    </View>
  );
};

export default SearchingView;
